<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <!--渲染器-->
    <meta name="renderer" content="webkit">
    <!--优先使用最新版本的IE 和 Chrome 内核-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>SIYUCMS 后台管理面板</title>
    <!-- 告诉浏览器该页面是自适应布局 -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    {include file="public/css_js" /}
    {// 额外CSS代码 }
    {$extra_css|raw|default=''}
</head>
<!--
BODY TAG OPTIONS:
=================
应用以下一个或多个类以达到你想要的效果
|---------------------------------------------------------|
| SKINS         | skin-blue                               |
|               | skin-black                              |
|               | skin-purple                             |
|               | skin-yellow                             |
|               | skin-red                                |
|               | skin-green                              |
|---------------------------------------------------------|
|LAYOUT OPTIONS | fixed                                   |
|               | layout-boxed                            |
|               | layout-top-nav                          |
|               | sidebar-collapse                        |
|               | sidebar-mini                            |
|---------------------------------------------------------|
-->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <!-- Main Header -->
    <header class="main-header">
        <!-- Logo -->
        <a href="{:url('Index/index')}" class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"><b>SIYU</b></span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg"><b>SIYU</b> CMS</span>
        </a>
        <!-- Header Navbar -->
        <nav class="navbar navbar-static-top" role="navigation">
            <!-- 切换边栏-->
            <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button" title="切换边栏">
                <span class="sr-only">切换边栏</span>
            </a>
            <a href="javascript:;" class="sidebar-toggle fullscreen" title="全屏模式">
                <i class="glyphicon glyphicon-fullscreen"></i>
            </a>
            <!-- Navbar Left Menu -->
            <ul class="nav navbar-nav js_left_menu">
                <li class="active">
                    <a href="javascript:;">
                        <i class="fa  fa-gear"></i>
                        <span>主导航</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;">
                        <i class="fa fa-th-large"></i>
                        <span>内容管理</span>
                    </a>
                </li>
            </ul>
            <!-- Navbar Right Menu -->
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <!-- User Account Menu -->
                    <li class="dropdown user user-menu">
                        <!-- Menu Toggle Button -->
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <!-- The user image in the navbar-->
                            <img src="{:session('admin.image') ? session('admin.image') : '/static/plugins/AdminLTE/dist/img/user2-160x160.jpg'}" class="user-image">
                            <!-- hidden-xs hides the username on small devices so only the image appears. -->
                            <span class="hidden-xs">{:session('admin.nickname') ? session('admin.nickname') : session('admin.username')}</span>
                        </a>
                        <ul class="dropdown-menu">
                            <!-- The user image in the menu -->
                            <li class="user-header">
                                <img src="{:session('admin.image') ? session('admin.image') : '/static/plugins/AdminLTE/dist/img/user2-160x160.jpg'}" class="img-circle">

                                <h5>
                                    上次登录时间：{:session('admin.login_time')}
                                </h5>
                                <h5>
                                    上次登录IP：{:session('admin.login_ip')}
                                </h5>
                            </li>
                            <!-- Menu Footer-->
                            <li class="user-footer">
                                <div class="pull-left">
                                    <a href="{:url('Admin/edit',['id'=>session('admin.id')])}" class="btn btn-default btn-flat">资料</a>
                                </div>
                                <div class="pull-right">
                                    <a href="{:url('Login/logout')}" class="btn btn-default btn-flat">退出</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a class="js_clear_cash" href="javascript:;" title="清空缓存">
                            <i class="glyphicon glyphicon-refresh"></i>
                        </a>
                    </li>
                    <li>
                        <a href="/" target="_blank" title="访问系统前台">
                            <i class="glyphicon glyphicon-home"></i>
                        </a>
                    </li>
                    <!-- Control Sidebar Toggle Button -->
                    <li>
                        <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <script>
        // 主导航、内容管理切换
        $(".js_left_menu li").click(function () {
            // 通过 .index()方法获取元素下标，从0开始，赋值给某个变量
            var _index = $(this).index();
            // 让左侧菜单第 _index 个显示出来，其他的被隐藏
            $(".js_left_menu_show").eq(_index).show().siblings('.js_left_menu_show').hide();
            // 当前菜单添加选中效果,同级的移除。
            $(this).addClass('active').siblings('li').removeClass('active');
        })

        // 清空缓存
        $(".js_clear_cash").click(function () {
            var url = "{:url('index/clear')}";
            $.modal.confirm('确定要清除缓存吗？', function () {
                $.post(url, {
                    del: true
                }, function (result) {
                    if (result.error == 0) {
                        $.modal.alertSuccess(result.msg, function (index) {
                            layer.close(index);
                            $.pjax.reload('.content-wrapper'); // pjax 重载
                        });
                    } else {
                        $.modal.alertError(result.msg);
                    }
                });
            });
        })

    </script>
